<h1>Bugs report</h1>

<form action="" >
<% systems = System.find(:all) %>
Show report for system <%= select 'systems', 'system_id', systems.collect {|s| [s.name, s.id] } %> <input type="submit" value="Change" /></p>
</form>

<% 
    if systems
        if !params[:systems]
            system = systems[0]
        else    
            system = System.find params[:systems][:system_id]
        end
%>
<h2>Bugs for system: <%= system.name %></h2>
<ul>
<% for bug in system.bugs %>
<li>[<%= bug.id %>] <%= bug.description %><br />Reported by: <%= link_to bug.user.name, :controller => 'users', :action => 'show', :id => bug.user.id %></li>
<% end %>
</ul>
<% end %>